namespace BL.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class InitialCreate : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.MenuItems",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Name = c.String(),
                        Parent_ID = c.Int(),
                    })
                .PrimaryKey(t => t.ID)
                .ForeignKey("dbo.MenuItems", t => t.Parent_ID)
                .Index(t => t.Parent_ID);
            
            CreateTable(
                "dbo.Locations",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Lat = c.Single(nullable: false),
                        Lng = c.Single(nullable: false),
                        Details_ID = c.Int(),
                        MenuItem_ID = c.Int(),
                    })
                .PrimaryKey(t => t.ID)
                .ForeignKey("dbo.LocationDetails", t => t.Details_ID)
                .ForeignKey("dbo.MenuItems", t => t.MenuItem_ID)
                .Index(t => t.Details_ID)
                .Index(t => t.MenuItem_ID);
            
            CreateTable(
                "dbo.LocationDetails",
                c => new
                    {
                        ID = c.Int(nullable: false, identity: true),
                        Discriminator = c.String(nullable: false, maxLength: 128),
                    })
                .PrimaryKey(t => t.ID);
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.Locations", new[] { "MenuItem_ID" });
            DropIndex("dbo.Locations", new[] { "Details_ID" });
            DropIndex("dbo.MenuItems", new[] { "Parent_ID" });
            DropForeignKey("dbo.Locations", "MenuItem_ID", "dbo.MenuItems");
            DropForeignKey("dbo.Locations", "Details_ID", "dbo.LocationDetails");
            DropForeignKey("dbo.MenuItems", "Parent_ID", "dbo.MenuItems");
            DropTable("dbo.LocationDetails");
            DropTable("dbo.Locations");
            DropTable("dbo.MenuItems");
        }
    }
}
